//
//  BaseNavigationVC.m
//  KuaiTu
//
//  Created by 江伟 on 2018/10/24.
//  Copyright © 2018年 WeiJiang. All rights reserved.
//

#import "BaseNavigationVC.h"

@interface BaseNavigationVC ()

@end

@implementation BaseNavigationVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.navigationBar setBackgroundImage:[Functions createImageColor:mainColor size:CGSizeMake(KWidth, NavigationBar_Height)] forBarMetrics:UIBarMetricsDefault];
    UIImage *image = [[UIImage alloc]init];
    image = [image imageWithColor:[UIColor redColor]];
    [self.navigationBar setShadowImage:image];
    self.navigationBar.translucent = NO;
    self.navigationBar.tintColor = [UIColor whiteColor];
    [self.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor colorWithHexString:@"1e2138"],NSFontAttributeName:[UIFont boldSystemFontOfSize:16]}];
}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
    if (self.viewControllers.count >= 1) {
        viewController.hidesBottomBarWhenPushed = YES;
        viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:IMG(@"back") style:UIBarButtonItemStyleDone target:self action:@selector(clickBackBtn)];
    }
    if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.interactivePopGestureRecognizer.delegate = nil;
    }
    [super pushViewController:viewController animated:animated];
}

- (void)clickBackBtn {
    [self popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
